
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.prime.com.tr/ui">

<h:head>
	<title>Cadastro de Empresa</title>

</h:head>

<h:body>
	<h:form id="formempresa">

		<p:growl id="mensagemConfirmacao" />
		<p:wizard backLabel="Anterior" nextLabel="Proximo" flowListener="#{empresaAction.onFlowProcess}">

			<p:tab id="personal" title="Pessoal" >

				<ui:include src="/cadastroempresas/dadospessoais.xhtml" />

			</p:tab>


			<p:tab id="address" title="Endereço">

				<ui:include src="/cadastroempresas/dadosendereco.xhtml" />


			</p:tab>

			<p:tab id="contact" title="Contato">
				<ui:include src="/cadastroempresas/dadoscontato.xhtml" />
			</p:tab>

			<p:tab id="confirm" title="Confirmar">
				<p:panel header="Confirmação">

					<p:growl id="growl" sticky="true" showDetail="true" />

					<h:panelGrid id="confirmation" columns="6">
						<h:outputText value="Nome Completo:" />
						<h:outputText styleClass="outputLabel"
							value="#{empresaAction.empresa.nomePessoa}" />

						<h:outputText value="Cpf: " />
						<h:outputText styleClass="outputLabel"
							value="#{empresaAction.empresa.cnpj}" />

						<h:outputText value="Data de Nascimento: " />
						<h:outputText styleClass="outputLabel"
							value="#{empresaAction.empresa.dataNascimento}" />

						<h:outputText value="Logradouro: " />
						<h:outputText styleClass="outputLabel"
							value="#{empresaAction.empresa.endereco.nomeRua}" />



						<h:outputText value="Email: " />
						<h:outputText styleClass="outputLabel"
							value="#{empresaAction.empresa.email}" />

						<h:outputText value="Telefone Residencial: " />
						<h:outputText styleClass="outputLabel"
							value="#{empresaAction.empresa.telefoneResidencial}" />

						<h:outputText value="Telefone Celular: " />
						<h:outputText styleClass="outputLabel"
							value="#{empresaAction.empresa.telefoneCelular}" />

						<h:outputText />
						<h:outputText />
					</h:panelGrid>
					<!-- Botao cancelado -->
					<p:commandButton id="salvar" value="Salvar" update="growl"
						actionListener="#{empresaAction.salvarEmpresa}" rendered="false" />
					<!-- Botao cancelado -->
					<p:commandButton value="Salvar" onclick="confirmation.show()"
						type="button" />


					<p:confirmDialog message="Confirma a gravação dos dados?"
						modal="true" hideEffect="explode"
						header="Confirmação" severity="alert" widgetVar="confirmation">

						<p:commandButton value="Sim" update="mensagemConfirmacao"
							oncomplete="confirmation.hide()"
							actionListener="#{empresaAction.salvarEmpresa}"
							onclick="telaCadas.show()" ajax="false" />
						<p:commandButton value="Não" onclick="confirmation.hide()"
							type="button" />

					</p:confirmDialog>


				</p:panel>
			</p:tab>

		</p:wizard>
		<p:dialog id="telaConfirmacaoCadastro"
			rendered="#{empresaAction.cadastraEmpresa}"
			widgetVar="telaCadas" width="250" height="120"
			header="Empresa cadastrada" resizable="false" modal="true">

			<h:outputLabel value="Dados armazenados com sucesso!"
				style="color:blue;" />
			<h:panelGrid cellspacing="15">
				<p:commandButton value="Ok"
					actionListener="#{empresaAction.redirecionePaginaCadastro}"
					oncomplete="telaCadas.hide()" />
			</h:panelGrid>


		</p:dialog>
	</h:form>
</h:body>

</html>

